from rest_framework import serializers

# class CategorySerializer(serializers.Serializer):
#     id = serializers.IntegerField(label='ID', read_only=True)
#     name = serializers.CharField(label='分类', max_length=30)
#      description = serializers.CharField(allow_blank=True, allow_null=True,
#                                          label='详细说明', required=False,
#                                          style={'base_templa 'textarea.html'})
from app.models import Category


class CategorySerializer(serializers.ModelSerializer):
    class Meta:
        model = Category
        fields = ('id', 'name', 'description', 'sub_categories')
